package com.atguigu.common;

import lombok.Data;

@Data
public class R {
    private int code;
    private String msg;
    private Object data;

    public static R ok() {

        R r = new R();
        r.code = 200;
        r.msg = "success";
        return r;

    }
    public static R ok(Object data, String msg) {
        R r = new R();
        r.setCode(200);
        r.setData(data);
        r.setMsg(msg);
        return r;

    }

    public static R error() {
        R r = new R();
        r.code = 500;
        r.msg = "error";
        return r;
    }

    public static R error(String msg, Integer code) {
        R r = new R();
        r.setCode(code);
        r.setMsg(msg);
        return r;
    }
}
